<html>
<head><meta charset="utf-8"><title>fix tests for #76098 · t-compiler/help-wanted · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/index.html">t-compiler/help-wanted</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html">fix tests for #76098</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212439081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212439081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212439081">(Oct 06 2020 at 14:52)</a>:</h4>
<p>Hello! I'm looking for help fixing the tests for <a href="https://github.com/rust-lang/rust/pull/76098">this pr</a> if anyone would be willing to help out, it would be much appreciated!</p>



<a name="212439604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212439604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212439604">(Oct 06 2020 at 14:56)</a>:</h4>
<p>More specifically, it looks like tests are failing because <code>::1</code> is being parsed as different than <code>::0.0.0.1</code>, and I'm not sure why</p>



<a name="212440428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212440428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212440428">(Oct 06 2020 at 15:01)</a>:</h4>
<p>More generally, i don't feel confident in my ability to write tests for <code>ip</code> because of the use of both macros and bit shifting, which are not things i'm super comfortable with</p>



<a name="212479623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212479623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212479623">(Oct 06 2020 at 20:15)</a>:</h4>
<p>Whenever I write macro based code, I pull this out: <a href="https://cheats.rs/#macros-attributes">https://cheats.rs/#macros-attributes</a><br>
I usually wind up uncertain enough I have to read <a href="https://doc.rust-lang.org/reference/macros-by-example.html">https://doc.rust-lang.org/reference/macros-by-example.html</a><br>
And <a href="https://doc.rust-lang.org/book/ch19-06-macros.html">https://doc.rust-lang.org/book/ch19-06-macros.html</a> is a good introduction to macros.</p>



<a name="212480235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212480235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212480235">(Oct 06 2020 at 20:19)</a>:</h4>
<p>That said, you can also direct any more specific questions for me.<br>
Which tests are we fixing up?</p>
<div class="codehilite"><pre><span></span><code>failures:
    [ui] ui/consts/std/net/ipv6.rs
</code></pre></div>


<p>Ah, I see.</p>
<div class="codehilite"><pre><span></span><code>---- [ui] ui/consts/std/net/ipv6.rs stdout ----

error: test run failed!
status: exit code: 101
command: &quot;/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/std/net/ipv6/a&quot;
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
thread &#39;main&#39; panicked at &#39;assertion failed: IS_LOOPBACK&#39;, /checkout/src/test/ui/consts/std/net/ipv6.rs:21:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

------------------------------------------
</code></pre></div>


<p>Hmmm.</p>



<a name="212483061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212483061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212483061">(Oct 06 2020 at 20:42)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">IS_LOOPBACK</span><span class="w"> </span>: <span class="kt">bool</span> <span class="o">=</span><span class="w"> </span><span class="n">IP_ADDRESS</span><span class="p">.</span><span class="n">is_loopback</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">assert</span><span class="o">!</span><span class="p">(</span><span class="n">IS_LOOPBACK</span><span class="p">);</span><span class="w"></span>
</code></pre></div>

<p>So, you notice how these tests are split between the UI test suite and typical Rust <code>#[test]</code> tests?  This failing test is a <code>// run-pass</code> test which is basically no different from an ordinary <code>#[test]</code> except that it takes extra time to compile and run and is often a little harder to setup, diagnose, and fix. So really, this means that this <code>src/test/ui/consts/std/net/ipv6.rs</code> test doesn't need to be in the UI test suite. It should be in the library tests. See <a href="https://github.com/rust-lang/rust/issues/76268">https://github.com/rust-lang/rust/issues/76268</a> for a bigger explanation if you so desire.</p>
<p>This will help us a <em>little</em> because then you can also split up all these distinct assertions into separate <code>#[test]</code> functions. Right now, if <em>any</em> of those asserts fails, the entire test here fails, but we want to know which assertions fail. At the very least, we want to be able to move these into a pile of things that don't fail and separate out the ones that do fail.</p>
<p><strong>EDIT:</strong> Oh, reading more closely, I can see that that has already partially happened and some of the tests already live in <code>library/std/src/net/ip/tests.rs</code>. You should finish removing the run-pass test file from <code>ui</code> then, and make sure that all the tests are in the library.</p>



<a name="212486809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212486809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212486809">(Oct 06 2020 at 21:15)</a>:</h4>
<p>currently building your branch. woof, did I really have to rebuild LLVM? Ah well.</p>



<a name="212489046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212489046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212489046">(Oct 06 2020 at 21:36)</a>:</h4>
<p>hi! <span class="user-mention" data-user-id="281757">@Jubilee</span> thank you so much for getting back to me :) i do see what you're talking about in terms of there being tests in both <code>src/test/ui/consts/std/net</code> and <code>library/std/src/net/ip</code>, but if I am understanding correctly...in my terminal output there isn't any failing UI tests, and the only ones that fail are coming from <code>net::ip::tests</code> which...i would assume is <code>library/std/src/net/ip/tests.rs</code> and not <code>src/test/ui/consts/std/net/ipv(4|6).rs</code></p>



<a name="212489083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212489083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212489083">(Oct 06 2020 at 21:36)</a>:</h4>
<p>i'm only getting six failing tests</p>
<div class="codehilite"><pre><span></span><code>failures:
    net::ip::tests::ip_properties
    net::ip::tests::ipv6_addr_to_string
    net::ip::tests::ipv6_const
    net::ip::tests::ipv6_from_contructors
    net::ip::tests::ipv6_properties
</code></pre></div>



<a name="212489199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212489199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212489199">(Oct 06 2020 at 21:37)</a>:</h4>
<p>oh weird i see a ui test failed in CI</p>



<a name="212492780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212492780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212492780">(Oct 06 2020 at 22:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/212497-t-compiler.2Fhelp-wanted/topic/fix.20tests.20for.20.2376098/near/212479623">said</a>:</p>
<blockquote>
<p>Whenever I write macro based code, I pull this out: <a href="https://cheats.rs/#macros-attributes">https://cheats.rs/#macros-attributes</a></p>
</blockquote>
<p>This is so cool!</p>



<a name="212495492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212495492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212495492">(Oct 06 2020 at 22:47)</a>:</h4>
<p>Yeah, the UI tests will fail in CI, which is all I had to go on.</p>



<a name="212496847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212496847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212496847">(Oct 06 2020 at 23:06)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> gotcha gotcha. i just pushed a change that fixed a couple of the unit tests but some are still broken. specifically:</p>
<div class="codehilite" data-code-language="Terminfo"><pre><span></span><code><span class="nt">failures:</span>

<span class="nt">----</span><span class="na"> net::ip::tests::ip_properties stdout ----</span>
<span class="na">thread '&lt;unnamed&gt;' panicked at 'assertion failed: !ip!("fe80:ffff::").is_global()'</span><span class="p">,</span> <span class="nc">library/std/src/net/ip/tests.rs:302:5</span>

<span class="nt">----</span><span class="na"> net::ip::tests::ipv6_properties stdout ----</span>
<span class="na">thread '&lt;unnamed&gt;' panicked at 'assertion failed: !ip!("fe80:ffff::").is_global()'</span><span class="p">,</span> <span class="nc">library/std/src/net/ip/tests.rs:608:5</span>


<span class="nt">failures:</span>
<span class="err">    net::ip::tests::ip_properties</span>
<span class="err">    net::ip::tests::ipv6_properties</span>
</code></pre></div>

<p>i'm <em>pretty</em> sure these are failing because of my main change, which was to modify the behavior of <code>is_unicast_link_local</code></p>



<a name="212496891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212496891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212496891">(Oct 06 2020 at 23:07)</a>:</h4>
<p>the issue that was preventing stabilization for a while was that</p>



<a name="212496893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212496893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212496893">(Oct 06 2020 at 23:07)</a>:</h4>
<p>hang on lemme find the docs</p>



<a name="212497083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212497083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212497083">(Oct 06 2020 at 23:10)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/library/std/src/net/ip.rs#L1214-L1262">here</a> is the behavior of the current <code>is_unicast_link_local_strict</code>, which was promoted to <code>is_unicast_link_local</code> per the discussion <a href="https://github.com/rust-lang/rust/pull/76098#issuecomment-686901980">here</a> and the old <code>is_unicast_link_local</code> was removed</p>



<a name="212497287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212497287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212497287">(Oct 06 2020 at 23:12)</a>:</h4>
<p>i <em>suspect</em> but am completely unsure that i should change something in <a href="https://github.com/rust-lang/rust/blob/master/library/std/src/net/ip/tests.rs#L257-L261">these lines</a> to modify how we're checking global-ness</p>



<a name="212497341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212497341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212497341">(Oct 06 2020 at 23:13)</a>:</h4>
<p>because the address that's failing (<code>fe80::ffff::</code>) would have passed the check for the <em>old</em> <code>is_unicast_link_local</code> but should fail the <em>new</em> <code>is_unicast_link_local</code></p>



<a name="212497381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212497381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212497381">(Oct 06 2020 at 23:13)</a>:</h4>
<p>hmm.</p>



<a name="212497712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212497712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212497712">(Oct 06 2020 at 23:18)</a>:</h4>
<p>what command were you running tests with, btw?</p>



<a name="212502285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212502285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212502285">(Oct 07 2020 at 00:19)</a>:</h4>
<p><code>./x.py test library/std</code></p>



<a name="212502973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212502973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212502973">(Oct 07 2020 at 00:30)</a>:</h4>
<p>Okay, so it looks like the real trouble with macros is with grasping the <code>check!</code> macro?</p>



<a name="212503513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503513">(Oct 07 2020 at 00:40)</a>:</h4>
<p>i think? honestly i'm so lost that i'm not even sure where exactly i'm lost. but starting there would be great <span aria-label="smiley" class="emoji emoji-1f603" role="img" title="smiley">:smiley:</span></p>



<a name="212503603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503603">(Oct 07 2020 at 00:42)</a>:</h4>
<p>i can see tho that as far as i can tell the tests that are <a href="https://github.com/rust-lang/rust/runs/1217681449?check_suite_focus=true#step:23:1962">failing in CI</a> are the same ones that are failing on my machine</p>



<a name="212503683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503683">(Oct 07 2020 at 00:44)</a>:</h4>
<p>ok so here's my understanding</p>



<a name="212503688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503688">(Oct 07 2020 at 00:44)</a>:</h4>
<p>the <code>check!</code> macro is called without any arguments, which calls itself again with <code>0</code> for the second arg</p>



<a name="212503711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503711">(Oct 07 2020 at 00:45)</a>:</h4>
<p>then, a bunch of masks are defined e.g. <code>let unspec: u8 = 1 &lt;&lt; 0;</code></p>



<a name="212503733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503733">(Oct 07 2020 at 00:46)</a>:</h4>
<p>then the input mask (in our case <code>00000000</code> is bitwise-anded with the various masks that were defined to determine if the ip address fits a given rule or not (e.g. it's globally routable)</p>



<a name="212503781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503781">(Oct 07 2020 at 00:46)</a>:</h4>
<p>so...i think the behavior itself is correct, but the test is what's wrong</p>



<a name="212503788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503788">(Oct 07 2020 at 00:46)</a>:</h4>
<p>so if i adjust the mask for <code>global</code>, it should reflect by passing the test</p>



<a name="212503804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503804">(Oct 07 2020 at 00:47)</a>:</h4>
<p>WAIT</p>



<a name="212503812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503812">(Oct 07 2020 at 00:47)</a>:</h4>
<p>i think it's actually even simpler than that</p>



<a name="212503818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503818">(Oct 07 2020 at 00:47)</a>:</h4>
<p>because i think...technically...<code>fe80:ffff::</code> is globally routable</p>



<a name="212503821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503821">(Oct 07 2020 at 00:47)</a>:</h4>
<p>so it's failing because we don't specify that that should be the case</p>



<a name="212503880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503880">(Oct 07 2020 at 00:48)</a>:</h4>
<p>because what's happening is that it's getting flagged as unicast_global</p>



<a name="212503891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212503891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212503891">(Oct 07 2020 at 00:48)</a>:</h4>
<p>because of the change to is_unicast_link_local</p>



<a name="212504104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212504104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212504104">(Oct 07 2020 at 00:53)</a>:</h4>
<p>Okay, so... </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">unicast_link_local</span>: <span class="kt">u16</span> <span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span><span class="w"> </span><span class="c1">//        0b010000</span>
<span class="kd">let</span><span class="w"> </span><span class="n">unicast_link_local_strict</span>: <span class="kt">u16</span> <span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span><span class="w"> </span><span class="c1">// 0b100000</span>

<span class="c1">// Later on, we BitOr the two https://doc.rust-lang.org/nightly/core/ops/trait.BitOr.html</span>
<span class="w">  </span><span class="n">unicast_link_local</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">unicast_link_local_strict</span><span class="w"> </span><span class="c1">// 0b110000</span>
</code></pre></div>

<p>and then THAT is fed in as the mask.<br>
You can see this better formatted here if you run it:<br>
<a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=ab0378f9e3c33170e75cccbf0d5702c5">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=ab0378f9e3c33170e75cccbf0d5702c5</a></p>



<a name="212504189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212504189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212504189">(Oct 07 2020 at 00:55)</a>:</h4>
<p>So it appears that removing the BitOr there is what is breaking the test.</p>



<a name="212505710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212505710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212505710">(Oct 07 2020 at 01:22)</a>:</h4>
<p>oh gotcha ok. i think what i need to do is actually patch the test cases (duh), i kind of just blindly removed that stuff and hoped for the best</p>



<a name="212505806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212505806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212505806">(Oct 07 2020 at 01:24)</a>:</h4>
<p>I'm confused though, isn't this wrong?</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="n">check</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="s">"fe80:ffff::"</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="o">&amp;</span><span class="p">[</span><span class="mh">0xfe</span><span class="p">,</span><span class="w"> </span><span class="mh">0x80</span><span class="p">,</span><span class="w"> </span><span class="mh">0xff</span><span class="p">,</span><span class="w"> </span><span class="mh">0xff</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">],</span><span class="w"></span>
<span class="w">        </span><span class="n">unicast_link_local</span><span class="w"></span>
<span class="w">    </span><span class="p">);</span><span class="w"></span>
</code></pre></div>

<p>Isn't this what's cited as an example of what's not accepted?<br>
I guess I'm just restating what you already said.</p>



<a name="212506084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212506084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212506084">(Oct 07 2020 at 01:30)</a>:</h4>
<p>a hexadecimal digit encompasses a nybble<br>
two hexadecimal digits encompass a byte<br>
4 hexadecimal digits are 2 bytes<br>
<code>x:</code> is up to 4 hex digits, so up to 2 bytes<br>
the unicast link local address specifies the first 64 bits, or 8 bytes<br>
so FE80:0000:0000:0000 is spoken for.</p>



<a name="212506223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212506223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212506223">(Oct 07 2020 at 01:33)</a>:</h4>
<p>I guess that's why the BitOr was used... to make it deliberately more permissive in the relaxed case.<br>
Yeah, you need to make sure the test cases are Actually Correct, unfortunately.<br>
Feel free to ask any additional questions, though I am not an expert on <a href="https://tools.ietf.org/html/rfc4291">https://tools.ietf.org/html/rfc4291</a> tbqh.</p>



<a name="212506401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212506401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212506401">(Oct 07 2020 at 01:37)</a>:</h4>
<p>For note: a macro is kind of like a <code>match</code> statement in some ways: it doesn't hit the branch where it calls itself with the <code>0</code> mask here because it's actually being called with a mask.</p>
<p>The macro takes what inputs are given to it and, after performing the "matching" on the inputs to determine what arm it actually  expands into, it expands, turning them into "arguments" to its "function". It expands into the first example that fits the arm definitions, and that can have some trippy consequences but usually it's fairly explicit how it goes. Especially here, in a "relatively" "simple" macro (scare quotes in full effect) that "only" up to a maximum of one time.</p>



<a name="212510532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212510532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212510532">(Oct 07 2020 at 03:00)</a>:</h4>
<p>okay here's a question for you -- and thank you by the way for being so helpful! -- a lot of these test cases are <em>specifically</em> to check the more relaxed behavior. should i...just delete those? i feel guilty deleting test cases but they're kind of useless. i suppose i could change them to check <code>global</code> instead of <code>unicast_link_local</code>to kind of...invert the test cases</p>



<a name="212513422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212513422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212513422">(Oct 07 2020 at 04:09)</a>:</h4>
<p>Yes, I suggest adding test cases that verify that the relaxed behavior is rejected,  which the <code>check</code> macro may not support. I do not know the exact details of the <code>is_global</code> check and how it should be, if there are things which fall into neither numeric range then they obviously should not be <code>true</code> for either.</p>



<a name="212513488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212513488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212513488">(Oct 07 2020 at 04:11)</a>:</h4>
<p>But yes, you are simply permitted to delete test cases that are irrelevant. If you want you can simply note in the commit message that you deleted it <strong>because</strong> it was irrelevant.</p>



<a name="212577396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212577396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212577396">(Oct 07 2020 at 15:39)</a>:</h4>
<p>Gotcha -- so what I decided to do was to invert the checks so that it verifies that the relaxed behavior is rejected, which is a property of the <code>check</code> macro if <code>unicast_link_local</code> is unspecified -- it'll automatically verify an address is <em>not</em> <code>unicast_link_local</code>. I feel comfortable doing this by bitwise-or'ing <code>global</code> with <code>unicast_global</code>, because there were already existing test cases using this technique. I'll mention this in my commit message.</p>



<a name="212613062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212613062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212613062">(Oct 07 2020 at 20:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="337739">Cass</span> <a href="#narrow/stream/212497-t-compiler.2Fhelp-wanted/topic/fix.20tests.20for.20.2376098/near/212503818">said</a>:</p>
<blockquote>
<p>because i think...technically...<code>fe80:ffff::</code> is globally routable</p>
</blockquote>
<p>A later RFC also specifies the whole of fe80::/10 for link-local unicast: <a href="https://tools.ietf.org/html/rfc5156#section-2.4">https://tools.ietf.org/html/rfc5156#section-2.4</a></p>



<a name="212613142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212613142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212613142">(Oct 07 2020 at 20:11)</a>:</h4>
<p>FWIW, this is also what the Linux kernel implements, and IN6_IS_ADDR_LINKLOCAL() of the C standard library</p>



<a name="212771027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212771027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212771027">(Oct 09 2020 at 02:10)</a>:</h4>
<p><span class="user-mention" data-user-id="294290">@NeoRaider</span> this is def worth bringing up in the PR bc i don't...think that's the current implementation</p>



<a name="212771043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/212497-t-compiler/help-wanted/topic/fix%20tests%20for%20%2376098/near/212771043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cass <a href="https://rust-lang.github.io/zulip_archive/stream/212497-t-compiler/help-wanted/topic/fix.20tests.20for.20.2376098.html#212771043">(Oct 09 2020 at 02:11)</a>:</h4>
<p>like my implementation, i mean</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>